package com.lock.subscribe.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author kinfeng
 * @date 2019-04-21 14:49
 * @desc
 */
public class DataUtil {

    public static <K,V> Map<K,V> generateMap(Object... params){
        Map map = new HashMap<>() ;
        for(int i=0;i<params.length;i+=2){
            map.put(params[i],params[i+1]) ;
        }
        return map ;
    }


    public static String getContext(String context){
        byte[] array = HexUtils.decode(context);
        context = Base64Util.encode(array);
        return context;
    }

    public static int returnPlatType(String platType){
        if("dx".equals(platType) || "yd".equals(platType)){
            return 3;
        }else if("wg".equals(platType)){
            return 2;
        }else{
            return 1;
        }
    }

}
